package com.project.service.impl;

import com.project.mapper.UserMapper;
import com.project.pojo.Apply;
import com.project.pojo.User;
import com.project.service.UserService;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 更改学生信息
     * @param user
     */
    @Override
    public void updateUser(User user) {
        //调用方法
        userMapper.updateUser(user);
    }
    /**
     * 登陆验证
     * @param userId
     * @param password
     * @return
     */
    @Override
    public User login(String userId, String password) {
        //调用方法
        User user = userMapper.login(userId, password);
        return user;
    }

    /**
     * 查询所有学生
     * @return
     */
    @Override
    public List<User> selectAllUser() {
        //调用方法
        List<User> userList = userMapper.selectAllUser();
        return userList;
    }

    /**
     * 添加学生用户
     * @param user
     */
    @Override
    public void addUser(User user) {
        //调用方法
        userMapper.addUser(user);
    }

    /**
     * 删除 学生
     * @param userId
     */
    @Override
    public void deleteUser(long userId) {
        //调用方法
        userMapper.deleteUser(userId);
    }


    /**
     * 添加申请
     * @param apply
     */
    @Override
    public void addApply(Apply apply) {
        //调用方法
        userMapper.addApply(apply);
    }
}
